<template>
    <view :style="themeColor">
        <view class="page" >
    <view class="flex benben-position-layout flex flex-wrap align-center searchHistroy_flex_0"    :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
            <view   class='flex flex-wrap align-center justify-between flex-sub searchHistroy_fd0_0'      >
            <view   class='flex flex-wrap align-center searchHistroy_fd0_0_c0'   @tap.stop="handleJumpDiy" data-type="back" data-url="1"   >
        <text class='fu-iconfont2  searchHistroy_fd0_0_c0_c0'    >&#xE794;</text>
</view>
    <view   class='flex flex-wrap align-stretch justify-center'      >
        <text class='searchHistroy_fd0_0_c1_c0'  >搜索</text>
</view>
    <view   class='flex flex-wrap align-center justify-end searchHistroy_fd0_0_c0'      >
        </view>
</view>

        </view>
<view :style="{height: (88+StatusBarRpx)+'rpx'}"  ></view>
    <view class="flex align-center benben-position-layout flex searchHistroy_flex_1"    :style="{top:(111+StatusBarRpx)+'rpx', }">
            <view   class='flex align-center flex-sub searchHistroy_fd1_0'      >
            <view   class='flex align-center flex-sub searchHistroy_fd1_0_c0'      >
        <image class='searchHistroy_fd1_0_c0_c0'  mode="aspectFit"  :src='STATIC_URL+"17.png"' @tap.stop="addSearchHistoryFunc()" @tap="searchFunc()" ></image>
<input class='flex-sub searchHistroy_fd1_0_c0_c1'   type="text" :focus='true' :placeholder="`请输入`" confirm-type="done" :maxlength="-1" placeholder-style="color:#999;font-size:28rpx"  @confirm="addSearchHistoryFunc()" v-model="keyword"  />
<image class='searchHistroy_fd1_0_c0_c2'  mode="aspectFit"  :src='STATIC_URL+"85.png"' @tap="ClearInputFunc()" v-if= " keyword!=''"></image>
</view>
    <view   class='flex flex-wrap align-center justify-center searchHistroy_fd1_0_c1'      >
        <text class='searchHistroy_fd1_0_c1_c0'     @tap.stop="searchFunc()" >搜索</text>
</view>
</view>

        </view>
<view :style="{height: '100rpx'}"  ></view>
<benben-popup v-model="popupShow1697182753655" :mask="true" :mask-close-able="true"  mode='center' :z-index='999'>
    <!---清空搜索历史flex布局开始-->
 <view class="flex flex-direction align-center benben-flex-layout searchHistroy_flex_2"    >
        <text class='searchHistroy_fd2_0'  >确认删除历史记录？</text>
    <view   class='flex flex-wrap align-center'      >
        <button class='searchHistroy_fd2_1_c0'  @tap.stop="popupShow1697182753655=false"  >取消</button>
<button class='searchHistroy_fd2_1_c1'  @tap.stop="emptySearchHistoryFunc()"  >确认</button>
</view>
</view>
        
<!---清空搜索历史flex布局结束-->
    
</benben-popup>
<!---搜索记录flex布局开始-->
 <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout searchHistroy_flex_3"   v-if= " date=='1'" >
            <view   class='flex flex-wrap align-center searchHistroy_fd3_0'      >
        <text class='searchHistroy_fd3_0_c0'  >历史搜索</text>
<image class='searchHistroy_fd3_0_c1'  mode="aspectFit"  :src='STATIC_URL+"86.png"' @tap.stop="popupShow1697182753655=true" ></image>
</view>
    <view   class='flex align-stretch searchHistroy_fd3_1'      >
            <template v-for = '(item,key0) in appSearchHistory'>
    <view   class='flex align-center justify-center searchHistroy_fd3_1_c0'   @tap.stop="handleJumpDiy" data-type="navigateTo" :data-url="`/pages/homePages/searchContent/searchContent?keyworld=${item.name}`" @longpress="handleLongpressFunc(item.name)" v-if= " item>='1'"   :key='key0'>
        <text class='searchHistroy_fd3_1_c0_c0'  >{{item.name}}</text>
<image class='searchHistroy_fd3_1_c0_c1'  mode="aspectFit"  :src='STATIC_URL+"87.png"' @tap.stop="deleteSearchHistoryFunc(item.name)" v-if= " item.name==removeIndex"></image>
</view>
    </template>
    
</view>
    <view   class='flex flex-wrap align-center'    v-if= " appSearchHistory.length<=0"  >
        <text class='searchHistroy_fd3_2_c0'    v-if= " keyword==''"  >暂无搜索记录</text>
<image class='searchHistroy_fd3_2_c1'  mode="aspectFit"  :src='STATIC_URL+"88.png"'  v-if= " date=='3'"></image>
</view>
</view>
        
<!---搜索记录flex布局结束-->
    
    
        </view>
    </view>
</template>
<script>
    
    export default {
        components:{},
        
        
        data(){
			return {"popupShow1697182753655":false,"keyword":"","dataList":[],"dataLists":[],"removeIndex":-1,"xainshi":false,"associateList":[],"date":"1"};
		},
		computed:{
            themeColor() {
              return this.$store.getters.themeColor
            },
                          appSearchHistory() {// 搜索历史
      return this.$store.state.appSearchHistory
    }
		},
		watch:{},
		onLoad(options){
            
		},
        onUnload() {
                
        },
		onReady(){
            
		},
		onShow(){
            
		},
		onHide(){
            
		},
		onResize(){
            
		},
		onPullDownRefresh(){
            
		},
		onReachBottom(e){
            
		},
		onPageScroll(e){
            
		},
		methods:{
                            //长按事件
                 handleLongpressFunc(index){
                       this.removeIndex = index;
                },
                //添加搜索历史
                 addSearchHistoryFunc(){
                                   this.$store.commit('appSearchHistoryAdd',{"name":this.keyword})
    this.$urouter.navigateTo(`/pages/homePages/searchContent/searchContent?keyworld=${this.keyword}`);
                },
                //删除搜索历史
                 deleteSearchHistoryFunc(name){
                                   this.$store.commit('appSearchHistoryDel',{"name":name})
                },
                //清空搜索记录
                 emptySearchHistoryFunc(){
                                   this.$store.commit('appSearchHistoryClean','')
    this.popupShow1697182753655 = false;
                },
                //搜索框输入内容
                 searchFunc(){
                        if( this.keyword!=''){
            this.$urouter.navigateTo(`/pages/homePages/searchContent/searchContent?receive=${this.keyword}`);
    }
    else{
                            this.$message.info('请输入想要搜索的商品');
    }
                },
                //清空输入框
                 ClearInputFunc(){
                       this.keyword = '';
                }
		}
    };
</script> 
<style lang="scss" scoped>
           .page{
            width: 100vw;
            overflow-x: hidden;
            min-height: calc(100vh - var(--window-bottom));
            background:var(--benbenbgColor1);background-size: 100% auto;
        }
    .searchHistroy_flex_0{
        background:#fff;width:750rpx;height:88rpx;overflow:hidden;z-index:10;top:0rpx;background-size:100% auto !important;
    }
    .searchHistroy_fd0_0_c1_c0{
        font-size:36rpx;font-weight:500;color:#333;line-height:88rpx;
    }
    .searchHistroy_fd0_0_c0_c0{
        font-size:36rpx;color:#333;
    }
    .searchHistroy_fd0_0_c0{
        width:120rpx;
    }
    .searchHistroy_fd0_0{
        padding:0rpx 32rpx 0rpx 32rpx;
    }
    .searchHistroy_flex_1{
        border-bottom:1px solid #eee;background:#fff;width:750rpx;height:100rpx;z-index:10;top:111rpx;background-size:100% auto !important;
    }
    .searchHistroy_fd1_0_c1_c0{
        color:#FFFFFF;font-size:28rpx;font-weight:500;
    }
    .searchHistroy_fd1_0_c1{
        background:#E63838;border-radius:36rpx 36rpx 36rpx 36rpx;width:136rpx;height:72rpx;margin:0rpx 0rpx 0rpx 72rpx;
    }
    .searchHistroy_fd1_0_c0_c2{
        width:28rpx;height:28rpx;border-radius:0rpx 0rpx 0rpx 0rpx;
    }
    .searchHistroy_fd1_0_c0_c1{
        margin:0rpx 0rpx 0rpx 16rpx;font-size:24rpx;font-weight:400;color:#333;
    }
    .searchHistroy_fd1_0_c0_c0{
        width:40rpx;height:40rpx;
    }
    .searchHistroy_fd1_0_c0{
        background:rgba(249, 249, 249, 1);background-size:100% auto !important;border-radius:34rpx 34rpx 34rpx 34rpx;margin:0rpx 0rpx 0rpx 32rpx;padding:0rpx 24rpx 0rpx 24rpx;height:72rpx;
    }
    .searchHistroy_fd1_0{
        margin:17rpx 32rpx 24rpx 0rpx;
    }
    .searchHistroy_flex_2{
        background:rgba(255, 255, 255, 1);border-radius:16rpx 16rpx 16rpx 16rpx;padding:64rpx 74rpx 48rpx 74rpx;
    }
    .searchHistroy_fd2_1_c1{
        background:#FD523E;border-radius:16rpx 16rpx 16rpx 16rpx;font-size:28rpx;color:var(--benbenFontColor3);margin:0rpx 0rpx 0rpx 12rpx;width:176rpx;height:72rpx;line-height:72rpx;
    }
    .searchHistroy_fd2_1_c0{
        background:#F8F8F8;border-radius:16rpx 16rpx 16rpx 16rpx;font-size:28rpx;color:var(--benbenFontColor1);margin:0rpx 12rpx 0rpx 0rpx;width:176rpx;height:72rpx;line-height:72rpx;
    }
    .searchHistroy_fd2_0{
        line-height:44rpx;font-size:32rpx;font-weight:500;color:#333333;margin:0rpx 0rpx 56rpx 0rpx;
    }
    .searchHistroy_flex_3{
        padding:0rpx 0rpx 0rpx 0rpx;margin:50rpx 0rpx 0rpx 0rpx;
    }
    .searchHistroy_fd3_2_c1{
        width:280rpx;height:269rpx;margin:214rpx 235rpx 0rpx 235rpx;
    }
    .searchHistroy_fd3_2_c0{
        color:var(--benbenFontColor2);font-size:24rpx;font-weight:400;margin:24rpx 0rpx 0rpx 24rpx;
    }
    .searchHistroy_fd3_1_c0_c1{
        width:18rpx;height:18rpx;border-radius:0rpx 0rpx 0rpx 0rpx;
    }
    .searchHistroy_fd3_1_c0_c0{
        font-size:24rpx;font-weight:400;color:rgba(51, 51, 51, 1);margin:0rpx 16rpx 0rpx 0rpx;-webkit-line-clamp:1;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;max-width:200rpx;
    }
    .searchHistroy_fd3_1_c0{
        background:#F8F8F8;margin:23rpx 12rpx 0rpx 24rpx;border-radius:32rpx 32rpx 32rpx 32rpx;width:190rpx;height:56rpx;
    }
    .searchHistroy_fd3_1{
        padding:0rpx 0rpx 0rpx 0rpx;
    }
    .searchHistroy_fd3_0_c1{
        width:24rpx;height:28rpx;margin:0rpx 0rpx 0rpx auto;
    }
    .searchHistroy_fd3_0_c0{
        font-size:32rpx;font-weight:500;color:#333333;
    }
    .searchHistroy_fd3_0{
        margin:0rpx 32rpx 0rpx 24rpx;
    }
</style>